<template>
  <div class="loading-page">
    <div class="room-item" v-for="(item, index) in rooms" :key="index" @click="setRoom(item.prop)">
      {{ item.label }}
    </div>
  </div>
</template>

<script>
export default {
  name: 'RoomSelect',
  props: {},
  components: {},
  data() {
    return {
      companyId: localStorage.getItem('companyId'),
      rooms: [
        { label: '1号', prop: 1 },
        { label: '2号', prop: 2 },
        { label: '3号', prop: 3 },
        { label: '4号', prop: 4 },
        { label: '5号', prop: 5 },
        { label: '6号', prop: 6 },
        { label: '7号', prop: 7 },
        { label: '8号', prop: 8 },
        { label: '9号', prop: 9 },
        { label: '10号', prop: 10 },
        { label: '11号', prop: 11 },
        { label: '12号', prop: 12 },
        { label: '13号', prop: 13 },
        { label: '14号', prop: 14 },
        { label: '15号', prop: 15 },
        { label: '16号', prop: 16 },
        { label: '17号', prop: 17 },
        { label: '18号', prop: 18 },
        { label: '19号', prop: 19 },
        { label: '20号', prop: 20 }
      ]
    }
  },
  methods: {
    setRoom(num) {
      localStorage.setItem('roomNum', Number(num))
      if (!this.companyId) {
        this.$router.replace('/company')
      } else {
        this.$router.replace('/')
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.loading-page {
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-wrap: wrap;
  padding: 20px;

  .room-item {
    width: 15vw;
    height: 15vw;
    background: #007aff;
    border-radius: 50%;
    margin-top: 15px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    margin-left: 15px;
  }
}
</style>
